<div id="wrapper" class="annotations">
	<div id="content">
		<div id="main">
			<div class="main-heading">
				<!--
				<form id="select-semester" action="" method="post">
					<fieldset>
						<label>Section</label>
						<select>
							<option></option>
						</select>
					</fieldset>
				</form>
				-->
				<h1><?php echo stripslashes($book->getTitle()); ?></h1>
			</div>

			<div id="notes" class="notes">
				<h1><?php echo stripslashes($section->getName()); ?></h1>
				<div id="_top"><?php echo stripslashes($content->getContent()); ?></div>
			</div>
			<div>
				<p style="text-align: right;">
					<?php
						$found = false;
						$next = null;
						$hasnext = null;
						for($i=0;$i<count($sections);$i++) {
							if($i < count($sections) -1 ) $hasnext = $sections[$i + 1]; 
							if(is_array($sections[$i])) {
								foreach($sections[$i] as $sec) {
									 if($sec->getId() == $section->getId()) {
										$found = true;
										continue;
									} else if($found) {
										$next = $sec->getId();
										break 2;
									}
								}
							} else if($sections[$i]->getId() == $section->getId()) {
								$found = true;
							} else if($found) {
								if(!$hasnext || !is_array($hasnext)) {
									$next = $sections[$i]->getId();
									break;
								}
							}
						}
	
						if($next) {
							echo link_to("Go To Next Section", 'books/showSection?id='.$next.'&bookid='.$book->getId());
							echo "&nbsp;&nbsp;&nbsp;";
						}
					?>
					<?php echo link_to("Go To TOC", 'books/showTOC?id='.$book->getId()) ?>
				</p>
			</div>
		</div>

                <? if ($show_annotations) { 
		include_partial('annotations/annoEditor',
				array('owner' => $annotate_owner, 'title' => $annotate_title,
				      'owner_sig' => $annotate_owner_sig, 'user_sig' => $annotate_user_sig, 'isowner' => $annotate_isowner, 'version_url' => true));
		} ?>

		<div id="sidebar">
			<div class="module books">
				<h3 class="gradient light">About this Book</h3>
				<div class="inner">
					<ul>
						<li class="last">
							<h4><?php echo stripslashes($book->getTitle()); ?></h4>
							<p><?php echo stripslashes($book->getAuthor()); ?></p>
						</li>
					</ul>
					<p><?php echo stripslashes($book->getSummary()); ?></p>
				</div>
			</div>
		</div>
	</div>
</div>
